登入後會看到這個畫面
點擊左上方的加號
import discord
# main.py
# 記得將items.json上傳
from discord import embeds, member, message
from discord.ext import commands
# from alive import stay
import discord
import json
bot = commands.Bot(command_prefix="!")
with open('items.json', "r", encoding = "utf8") as file:
data = json.load(file)
@bot.event
async def on_ready():
print("Bot in ready")
@bot.command()
async def hello(ctx):
await ctx.send("hello")
# stay()
bot.run(data['token'])
# 測試用程式碼
# alive.py
from flask import Flask
from threading import Thread
app = Flask(__name__)
@app.route('/')
def home():
return "Alive"
def run():
app.run(host = '0.0.0.0', port = 8080)
def stay():
stay = Thread(target = run)
stay.start()